﻿@model IEnumerable<TracNghiem.Areas.Admin.Models.Bai_VietModels>
<div align="center"><h1>QUẢN TRỊ BÀI VIẾT DỊCH VỤ</h1></div>             
<div class="container_12">    
    <div class="grid_12"> 
        <!-- Notification boxes -->
        @if (TempData["msg"] != null)
        {                            
            <span class="notification n-success">@TempData["msg"]</span>
        }
        @if (TempData["error"] != null)
        {                            
            <span class="notification n-error">@TempData["error"]</span>
        }
          @using (Html.BeginForm("FindBai_Viet", "Bai_viet", FormMethod.Post, new { id = "FindBai_Viet", name = "FindBai_Viet" }))
          {
          @*  <input type="hidden" name="dichvu_id" id="dichvu_id" value="@ViewBag.dichvu_id" /> *@
            <div class="bottom-spacing">
                <lable>Phân loại: </lable>
               @* @if (ViewBag.theanh != null)
                {                               
                    @Html.DropDownList("option_id",  ViewBag.theanh as SelectList, "----Chọn----", new { style = "margin-left:13px" })          
                }*@
                <select id="dichvu_id" name="dichvu_id" style="margin-left:34px">
                <option value="">------Chọn dịch vụ-----</option>
                                @Html.Raw(ViewBag.theanh);
</select>
            </div>
            <div class="bottom-spacing">
                Tên bài viết:
                
                <input type="text" class="input-short" name="timkiem" value="@ViewBag.timkiem" style="width:20%; margin-left:20px" />
                <input class="submit-green" type="submit" value="Tìm kiếm" style="width:8.5%; padding-left:3px"  />                
            
                 <div class="float-right">
                    <a href="@Url.Action("AddBaiHoc", "bai_viet")" class="button">
                        <span>Thêm mới<img src="@Url.Content("~/areas/admin/Content/themes/template/image/plus-small.gif")" width="12" height="9" alt="New article" /></span>
                    </a>
                </div>           
            </div>  
          }   
       @* @using (Html.BeginForm("FindTest_Subject", "Test_Subject", FormMethod.Post, new { id = "FindTest_Subject", name = "FindTest_Subject" }))
        {
 
            <div class="float-right">
                    <a href="@Url.Action("AddBaiHoc", "bai_viet")" class="button">
                        <span>Thêm mới<img src="@Url.Content("~/areas/admin/Content/themes/template/image/plus-small.gif")" width="12" height="9" alt="New article" /></span>
                    </a>
                </div>  
        }        *@
        @using (Html.BeginForm("CheckedAction", "Test_Subject", FormMethod.Post, new { id = "CheckedAction", name = "CheckedAction" }))
        { 
            <div class="module">
                 <h2 align="right">
                <span><a href="@Url.Action("Index", "admin")">Quay lại</a></span></h2>                    
                <div class="module-table-body">
                    <div class="scrolling">
                        <div class="data-table" style="width:100%">
                            <table id="myTable" class="tablesorter">
                                <thead>
                                    <tr>
                                        <th style="width:4%;">Xóa</th>
                                        <th style="width:4%;">Sửa</th>
                                        <th style="width:4%;">Chọn</th>
                                        <th style="width:4%;">STT</th> 
                                     @* <th style="width:10%;">Id</th>*@
                                        <th style="width:30%;">Tên bài viết</th>
                                        <th style="width:30%;">Thuộc dịch vụ</th>
                                        @*<th style="width:10%;">Trạng thái</th>*@
                                   
                                    </tr>
                                </thead>
                                <tbody>
                                    @{int stt = 0;}
                                    @foreach (var item in Model)
                                    {
                                        stt++;                                         
                                        
                                            <tr>
                                            <td class="align-center">
                                                <a href="@Url.Action("DeleteBaiHoc", "bai_viet", new { id = item.id })" onclick="return confirm('Bạn muốn xóa thông tin này?');" title="Xóa thông tin"><img src="@Url.Content("~/areas/admin/Content/themes/template/image/cross-on-white.gif")" width="16" height="16" alt="delete" /></a>
                                             
                                            </td>     
                                            <td class="align-center">
                                                <a href="@Url.Action("editbaihoc", "bai_viet", new { id = item.id })" title="Sửa thông tin"><img src="@Url.Content("~/areas/admin/Content/themes/template/image/pencil.gif")"  width="16" height="16" alt="edit" /></a>
                                                                                        
                                            </td>
                                            <td class="align-center">
                                                <input type="checkbox" name="Items" id="Items[]" value="@item.id"/>
                                                                                       
                                            </td>
                                            <td class="align-center">@stt</td> 
                                           @*  <td class="align-center">@item.id</td> *@
                                           
                                            <td>
                                             <a href="@Url.Action("INDEX", "NOI_DUNG", new { id = item.id })" title="Sửa thông tin">@Html.DisplayFor(modelItem => item.name)</a>
                                            </td>
                                            <td>@Html.DisplayFor(modelItem => item.tendichvu)</td>
                                         
                                        </tr>
                                    }
                                </tbody>
                            </table>
                        </div>      
                    </div>    
                    <div class="pager" id="pager">
                        <form action="">
                            <div>
                            <img class="first" src="@Url.Content("~/areas/admin/Content/themes/template/image/arrow-stop-180.gif")"/>
                            <img class="prev" src="@Url.Content("~/areas/admin/Content/themes/template/image/arrow-180.gif")"/> 
                            <input type="text" class="pagedisplay input-short align-center"/>
                            <img class="next" src="@Url.Content("~/areas/admin/Content/themes/template/image/arrow.gif")"/>
                            <img class="last" src="@Url.Content("~/areas/admin/Content/themes/template/image/arrow-stop.gif")"/> 
                            <select class="pagesize input-short align-center">
                                <option value="10" selected="selected">10</option>
                                <option value="20">20</option>
                                <option value="30">30</option>
                                <option value="40">40</option>
                            </select>
                            </div>
                        </form>
                    </div>
                    <div class="table-apply">
                        <div class="float-right">
                            <a style='cursor:pointer' onclick="return CheckItem();" class="button">
                                <span>Xóa chọn</span>
                            </a>
                        </div> 
                    </div>
                    <div style="clear: both"></div>
                    </div> <!-- End .module-table-body -->
            </div> <!-- End .module -->
        }    
	</div> <!-- End .grid_12 -->
</div> <!-- End .container_12 -->
<!----------------------------------------------------------------->
<script language="javascript" type="text/javascript">
    function CheckItem() {
        var arrCheckboxes = document.getElementsByName('Items');
        var checkCount = 0;
        for (var i = 0; i < arrCheckboxes.length; i++) {
            checkCount += (arrCheckboxes[i].checked) ? 1 : 0;
        }
        if (checkCount > 0) {
            if (confirm("Bạn chắc chắn muốn xóa thông tin đã chọn?"))
                document.forms["CheckedAction"].submit();
        } else {
            alert("Bạn chưa chọn thông tin cần xóa!");
            return false;
        }
    }
</script>
